package com.yue.redis;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

/**
 * 功能描述: TODO <br/>
 * 创建时间: 2016/11/24<br/>
 *
 * @author QiuYang
 */
public class SocketTest {
    public static void main(String[] args) throws IOException {
        String ip = "192.168.91.128";
        int port = 6379;
        Socket socket = new Socket(ip, port);
        InputStream in = socket.getInputStream();
        OutputStream out = socket.getOutputStream();

        out.write("zhangkai is huandan".getBytes());

        byte[] bytes = new byte[1024];

        int size = in.read(bytes);
        System.out.println(size);
        System.out.println(new String(bytes));
    }
}
